﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:NYTimes="clr-namespace:NYTimes;assembly=NYTimesWPFKit" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="MostPopularWindowsApp.MainWindow"
        Title="Most Popular New York Times Articles" Height="350" Width="525">
	<Window.Resources>
		<NYTimes:CommunityCommentsByUrl x:Key="CommunityCommentsByUrlDataSource" d:IsDataSource="True"/>
		<NYTimes:MostPopular x:Key="MostPopularDataSource" d:IsDataSource="True"/>
		<DataTemplate x:Key="MostPopularItemTemplate">
			<StackPanel>
				<TextBlock Text="{Binding Abstract}"/>
				<TextBlock Text="{Binding Byline}"/>
				<TextBlock Text="{Binding Column}"/>
				<TextBlock Text="{Binding PublishedDate}"/>
				<TextBlock Text="{Binding Section}"/>
				<TextBlock Text="{Binding Source}"/>
				<Image Source="{Binding Thumbnail}" HorizontalAlignment="Left" Height="64" Width="64"/>
				<TextBlock Text="{Binding Title}"/>
			</StackPanel>
		</DataTemplate>
		<DataTemplate x:Key="CommentTemplate">
			<StackPanel>
				<TextBlock Text="{Binding ApproveDate}"/>
				<TextBlock Text="{Binding Body}"/>
				<TextBlock Text="{Binding CommentQuestion}"/>
				<TextBlock Text="{Binding DisplayName}"/>
				<TextBlock Text="{Binding Location}"/>
				<TextBlock Text="{Binding Recommendations}"/>
				<TextBlock Text="{Binding Sharing}"/>
				<TextBlock Text="{Binding TimesPeople}"/>
				<TextBlock Text="{Binding Title}"/>
				<TextBlock Text="{Binding UserTitle}"/>
			</StackPanel>
		</DataTemplate>
	</Window.Resources>
    <Grid d:DataContext="{d:DesignData /SampleData/MostPopularSampleData.xaml}">
    	<Grid.ColumnDefinitions>
    		<ColumnDefinition />
    		<ColumnDefinition />
    	</Grid.ColumnDefinitions>
    	<ListBox ItemTemplate="{DynamicResource MostPopularItemTemplate}" ItemsSource="{Binding Results}" Margin="8,8,48,4"/>
    	<ListBox Grid.Column="1" DataContext="{Binding Source={StaticResource CommunityCommentsByUrlDataSource}}" ItemTemplate="{DynamicResource CommentTemplate}" ItemsSource="{Binding Results}" Margin="8"/>
    </Grid>
</Window>
